package com.itheima.object1;

import java.util.Random;
import java.util.Scanner;

//猜数字有戏
public class 猜数字有戏 {
    public static void main(String[] args) {
        Random r=new Random();
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入您要猜的数字");
        int b=r.nextInt(100);
        //System.out.println(b);
while (true) {
    int a= sc.nextInt();
    if (a > b) {
        System.out.println("猜大了");
    } else if (a < b) {
        System.out.println("猜小了");
    } else {
        System.out.println("猜对了");
        break;
    }
}
    }
}
